/********************************************************************
	created:	2009:12:7   21:16:58
	filename: 	appsettingdlg.cpp
	author:		zouyf
	describe:	
*********************************************************************/
#include "stdafx.h"
#include "appsettingdlg.h"

void FAppSettingDlg::Init(IAppSetting* pAppSetting)
{
	m_pAppSetting = pAppSetting;
}

BOOL FAppSettingDlg::OnInitDialog(CWindow wndFocus, LPARAM lInitParam)
{
	LPCWSTR lyricFolderPath = m_pAppSetting->GetLyricSetting()->GetLyricDir();
	::SetWindowText(::GetDlgItem(m_hWnd, IDC_APPSETTING_LYRICSAVE), lyricFolderPath);

	return TRUE;
}

void FAppSettingDlg::OnClickBtn(UINT uNotifyCode, int nID, CWindow wndCtl)
{
	switch(nID)
	{
	case IDC_APPSETTING_BROSW_BTN:
		{
			CFolderDialog dlg(m_hWnd);
			if (IDOK == dlg.DoModal(m_hWnd))
			{
				::SetWindowText(::GetDlgItem(m_hWnd, IDC_APPSETTING_LYRICSAVE), dlg.m_szFolderPath);
			}
		}
		break;
	case ID_APPSETTING_OK:
		{
			WCHAR pathbuf[MAX_PATH] = {0};
			::GetWindowText(::GetDlgItem(m_hWnd, IDC_APPSETTING_LYRICSAVE), pathbuf, MAX_PATH);
			m_pAppSetting->GetLyricSetting()->SetLyricDir(pathbuf);
			EndDialog(IDOK);
		}
		break;
	case ID_APPSETTING_CANCEL:
		EndDialog(IDNO);
		break;
	default:
		break;
	}
}
